<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件绑定</title>
</head>

<body>
    <div class="box">
        <p v-text='age'></p>
        <button v-on:click='handle'>点击+1</button>
        <button @click='handle1'>点击-1</button>
        <button @click='handle2'>归0</button>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        var vm = new Vue({
            el: '.box',
            data: {
                age: 0,
            },
            methods: {
                handle: function() {
                    console.log(this)
                    this.age++
                },
                handle1: function() {
                    this.age--
                },
                handle2: function() {
                    this.age = 0
                }
            }
        })
    </script>
</body>

</html>